﻿' LibWowArmory
' by Ronald M. Clifford (roncli@roncli.com)
'
' This source code is released under the GNU Library General Public License (LGPL) Version 2.1.

Imports System
Imports System.Linq

Namespace roncliProductions.LibWowArmory.Item.Search

    ''' <summary>
    ''' A class that encapsulates the Armory's item type filters
    ''' </summary>
    ''' <remarks></remarks>
    Public Class ItemTypeFilter

        Friend Property ItemType As String = "all"
        Friend Property DesiredBy As Integer
        Friend Property DesiredByRole As String
        Friend Property Rarity As String
        Friend Property WeaponSlot As String
        Friend Property WeaponType As String
        Friend Property RequiredLevelMin As Integer
        Friend Property RequiredLevelMax As Integer
        Friend Property ArmorSlot As String
        Friend Property ArmorType As String
        Friend Property GemType As String
        Friend Property BagType As String
        Friend Property ProjectilesType As String
        Friend Property QuiversType As String
        Friend Property RecipesType As String
        Friend Property SkillLevelMin As Integer
        Friend Property SkillLevelMax As Integer
        Friend Property PermanentEnchantmentSlot As String

#Region "Arrays"

        Private Shared strItemTypesWithDesiredBy() As String = {"all", "weapons", "armor", "gems", "glyphs"}
        Private Shared strItemTypesWithRarity() As String = {"all", "weapons", "armor", "gems", "consumables", "tradegoods", "projectiles", "recipes", "reagents", "misc", "enchP", "enchT"}
        Private Shared strItemTypesWithRequiredLevel() As String = {"all", "weapons", "armor"}
        Private Shared intDesiredByWithRole() As Integer = {6, 11, 2, 5, 7, 9, 1}
        Private Shared intDesiredByWithRoleTank() As Integer = {6, 11, 2, 1}
        Private Shared intDesiredByWithRoleMeleeDPS() As Integer = {6, 11, 2, 7, 1}
        Private Shared intDesiredByWithRoleCasterDPS() As Integer = {11, 2, 5, 7}
        Private Shared intDesiredByWithRoleHealer() As Integer = {11, 2, 5, 7}
        Private Shared intDesiredByWithRolePlusDamageOnly() As Integer = {9}
        Private Shared intDesiredByWithRolePlusDamageAndCrit() As Integer = {9}

        Public Shared Function DesiredByWithRole() As Integer()
            Return intDesiredByWithRole
        End Function

        Public Shared Function DesiredByWithRoleTank() As Integer()
            Return intDesiredByWithRoleTank
        End Function

        Public Shared Function DesiredByWithRoleMeleeDPS() As Integer()
            Return intDesiredByWithRoleMeleeDPS
        End Function

        Public Shared Function DesiredByWithRoleCasterDPS() As Integer()
            Return intDesiredByWithRoleCasterDPS
        End Function

        Public Shared Function DesiredByWithRoleHealer() As Integer()
            Return intDesiredByWithRoleHealer
        End Function

        Public Shared Function DesiredByWithRolePlusDamageOnly() As Integer()
            Return intDesiredByWithRolePlusDamageOnly
        End Function

        Public Shared Function DesiredByWithRolePlusDamageAndCrit() As Integer()
            Return intDesiredByWithRolePlusDamageAndCrit
        End Function

#End Region

        ''' <summary>
        ''' The type of the items to search for
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property ItemTypeFilter As Enums.ItemTypeType
            Get
                Select Case ItemType
                    Case "weapons"
                        Return Enums.ItemTypeType.Weapons
                    Case "armor"
                        Return Enums.ItemTypeType.Armor
                    Case "gems"
                        Return Enums.ItemTypeType.Gems
                    Case "containers"
                        Return Enums.ItemTypeType.Containers
                    Case "consumables"
                        Return Enums.ItemTypeType.Consumables
                    Case "tradegoods"
                        Return Enums.ItemTypeType.TradeGoods
                    Case "projectiles"
                        Return Enums.ItemTypeType.Projectiles
                    Case "quivers"
                        Return Enums.ItemTypeType.Quivers
                    Case "recipes"
                        Return Enums.ItemTypeType.Recipes
                    Case "reagents"
                        Return Enums.ItemTypeType.Reagents
                    Case "misc"
                        Return Enums.ItemTypeType.Miscellaneous
                    Case "enchP"
                        Return Enums.ItemTypeType.EnchantmentsPermanent
                    Case "enchT"
                        Return Enums.ItemTypeType.EnchantmentsTemporary
                    Case "mounts"
                        Return Enums.ItemTypeType.Mounts
                    Case "smallpets"
                        Return Enums.ItemTypeType.SmallPets
                    Case "keys"
                        Return Enums.ItemTypeType.Keys
                    Case "glyphs"
                        Return Enums.ItemTypeType.Glyphs
                    Case Else
                        Return Enums.ItemTypeType.AllItems
                End Select
            End Get
            Set(ByVal value As Enums.ItemTypeType)
                Clear()
                Select Case value
                    Case Enums.ItemTypeType.Weapons
                        ItemType = "weapons"
                    Case Enums.ItemTypeType.Armor
                        ItemType = "armor"
                    Case Enums.ItemTypeType.Gems
                        ItemType = "gems"
                    Case Enums.ItemTypeType.Containers
                        ItemType = "containers"
                    Case Enums.ItemTypeType.Consumables
                        ItemType = "consumables"
                    Case Enums.ItemTypeType.TradeGoods
                        ItemType = "tradegoods"
                    Case Enums.ItemTypeType.Projectiles
                        ItemType = "projectiles"
                    Case Enums.ItemTypeType.Quivers
                        ItemType = "quivers"
                    Case Enums.ItemTypeType.Recipes
                        ItemType = "recipes"
                    Case Enums.ItemTypeType.Reagents
                        ItemType = "reagents"
                    Case Enums.ItemTypeType.Miscellaneous
                        ItemType = "misc"
                    Case Enums.ItemTypeType.EnchantmentsPermanent
                        ItemType = "enchP"
                    Case Enums.ItemTypeType.EnchantmentsTemporary
                        ItemType = "enchT"
                    Case Enums.ItemTypeType.Mounts
                        ItemType = "mounts"
                    Case Enums.ItemTypeType.SmallPets
                        ItemType = "smallpets"
                    Case Enums.ItemTypeType.Keys
                        ItemType = "keys"
                    Case Enums.ItemTypeType.Glyphs
                        ItemType = "glyphs"
                End Select
            End Set
        End Property

        ''' <summary>
        ''' The class that the items to search for should be desired by
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property DesiredByFilter As Enums.DesiredByType
            Get
                Return CType(DesiredBy, Enums.DesiredByType)
            End Get
            Set(ByVal value As Enums.DesiredByType)
                If (From i In strItemTypesWithDesiredBy Where i.ToString = ItemType).Count = 0 Then
                    Throw New InvalidOperationException("The DesiredBy filter is only valid for ItemType values AllItems, Weapons, Armor, Gems, and Glyphs.")
                    Exit Property
                End If
                DesiredByRole = ""
                DesiredBy = CType(value, Integer)
            End Set
        End Property

        ''' <summary>
        ''' The role of the class the items to search for should be desired by
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property DesiredByRoleFilter As Enums.DesiredByRoleType
            Get
                Select Case DesiredByRole
                    Case "tank"
                        Return Enums.DesiredByRoleType.Tank
                    Case "melee"
                        Return Enums.DesiredByRoleType.MeleeDPS
                    Case "caster"
                        Return Enums.DesiredByRoleType.CasterDPS
                    Case "healer"
                        Return Enums.DesiredByRoleType.Healer
                    Case "dot"
                        Return Enums.DesiredByRoleType.PlusDamageOnly
                    Case "dd"
                        Return Enums.DesiredByRoleType.PlusDamageAndCrit
                    Case Else
                        Return Enums.DesiredByRoleType.AnyType
                End Select
            End Get
            Set(ByVal value As Enums.DesiredByRoleType)
                If (From i In intDesiredByWithRole Where i = DesiredBy).Count = 0 Then
                    Throw New InvalidOperationException("The DesiredByRole filter is only valid for DesiredBy values DeathKnight, Druid, Paladin, Priest, Shaman, Warlock, and Warrior.")
                    Exit Property
                End If
                Select Case value
                    Case Enums.DesiredByRoleType.AnyType
                        DesiredByRole = ""
                    Case Enums.DesiredByRoleType.Tank
                        If (From i In intDesiredByWithRoleTank Where i = DesiredBy).Count = 0 Then
                            Throw New InvalidOperationException("The DesiredByRole value of Tank is only valid for DesiredBy values DeathKnight, Druid, Paladin, and Warrior.")
                            Exit Property
                        End If
                        DesiredByRole = "tank"
                    Case Enums.DesiredByRoleType.MeleeDPS
                        If (From i In intDesiredByWithRoleMeleeDPS Where i = DesiredBy).Count = 0 Then
                            Throw New InvalidOperationException("The DesiredByRole value of MeleeDPS is only valid for DesiredBy values DeathKnight, Druid, Paladin, Shaman, and Warrior.")
                            Exit Property
                        End If
                        DesiredByRole = "melee"
                    Case Enums.DesiredByRoleType.CasterDPS
                        If (From i In intDesiredByWithRoleCasterDPS Where i = DesiredBy).Count = 0 Then
                            Throw New InvalidOperationException("The DesiredByRole value of CasterDPS is only valid for DesiredBy values Druid, Paladin, Priest, and Shaman.")
                            Exit Property
                        End If
                        DesiredByRole = "caster"
                    Case Enums.DesiredByRoleType.Healer
                        If (From i In intDesiredByWithRoleHealer Where i = DesiredBy).Count = 0 Then
                            Throw New InvalidOperationException("The DesiredByRole value of Healer is only valid for DesiredBy values Druid, Paladin, Priest, and Shaman.")
                            Exit Property
                        End If
                        DesiredByRole = "healer"
                    Case Enums.DesiredByRoleType.PlusDamageOnly
                        If (From i In intDesiredByWithRolePlusDamageOnly Where i = DesiredBy).Count = 0 Then
                            Throw New InvalidOperationException("The DesiredByRole value of PlusDamageOnly is only valid for DesiredBy value Warlock.")
                            Exit Property
                        End If
                        DesiredByRole = "dot"
                    Case Enums.DesiredByRoleType.PlusDamageAndCrit
                        If (From i In intDesiredByWithRolePlusDamageAndCrit Where i = DesiredBy).Count = 0 Then
                            Throw New InvalidOperationException("The DesiredByRole value of PlusDamageAndCrit is only valid for DesiredBy value Warlock.")
                            Exit Property
                        End If
                        DesiredByRole = "dd"
                End Select
            End Set
        End Property

        ''' <summary>
        ''' The rarity of the items to search for
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property RarityFilter As Enums.RarityType
            Get
                Select Case Rarity
                    Case "pr"
                        Return Enums.RarityType.Poor
                    Case "cn"
                        Return Enums.RarityType.Common
                    Case "un"
                        Return Enums.RarityType.Uncommon
                    Case "re"
                        Return Enums.RarityType.Rare
                    Case "ec"
                        Return Enums.RarityType.Epic
                    Case "lg"
                        Return Enums.RarityType.Legendary
                    Case "hm"
                        Return Enums.RarityType.Heirloom
                    Case Else
                        Return Enums.RarityType.All
                End Select
            End Get
            Set(ByVal value As Enums.RarityType)
                If (From i In strItemTypesWithRarity Where i.ToString = ItemType).Count = 0 Then
                    Throw New InvalidOperationException("The Rarity filter is only valid for ItemType values AllItems, Weapons, Armor, Gems, Consumables, TradeGoods, Projectiles, Recipes, Reagents, Miscellaneous, EnchantmentsPermanent, and EnchantmentsTemporary.")
                    Exit Property
                End If
                Select Case value
                    Case Enums.RarityType.All
                        Rarity = ""
                    Case Enums.RarityType.Poor
                        Rarity = "pr"
                    Case Enums.RarityType.Common
                        Rarity = "cn"
                    Case Enums.RarityType.Uncommon
                        Rarity = "un"
                    Case Enums.RarityType.Rare
                        Rarity = "re"
                    Case Enums.RarityType.Epic
                        Rarity = "ec"
                    Case Enums.RarityType.Legendary
                        Rarity = "lg"
                    Case Enums.RarityType.Heirloom
                        Rarity = "hm"
                End Select
            End Set
        End Property

        ''' <summary>
        ''' The slot of the weapons to search for
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property WeaponSlotFilter As Enums.WeaponSlotType
            Get
                Select Case WeaponSlot
                    Case "main"
                        Return Enums.WeaponSlotType.MainHand
                    Case "off"
                        Return Enums.WeaponSlotType.OffHand
                    Case "one"
                        Return Enums.WeaponSlotType.MainOrOffHand
                    Case "two"
                        Return Enums.WeaponSlotType.TwoHanded
                    Case "ranged"
                        Return Enums.WeaponSlotType.Ranged
                    Case Else
                        Return Enums.WeaponSlotType.AllSlots
                End Select
            End Get
            Set(ByVal value As Enums.WeaponSlotType)
                If ItemType <> "weapons" Then
                    Clear()
                End If
                ItemType = "weapons"
                Select Case value
                    Case Enums.WeaponSlotType.AllSlots
                        WeaponSlot = ""
                    Case Enums.WeaponSlotType.MainHand
                        WeaponSlot = "main"
                    Case Enums.WeaponSlotType.OffHand
                        WeaponSlot = "off"
                    Case Enums.WeaponSlotType.MainOrOffHand
                        WeaponSlot = "one"
                    Case Enums.WeaponSlotType.TwoHanded
                        WeaponSlot = "two"
                    Case Enums.WeaponSlotType.Ranged
                        WeaponSlot = "ranged"
                End Select
            End Set
        End Property

        ''' <summary>
        ''' The type of the weapons to search for
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property WeaponTypeFilter As Enums.WeaponTypeType
            Get
                Select Case WeaponType
                    Case "1haxe"
                        Return Enums.WeaponTypeType.OneHandedAxes
                    Case "2haxe"
                        Return Enums.WeaponTypeType.TwoHandedAxes
                    Case "bow"
                        Return Enums.WeaponTypeType.Bows
                    Case "gun"
                        Return Enums.WeaponTypeType.Guns
                    Case "1hmce"
                        Return Enums.WeaponTypeType.OneHandedMaces
                    Case "2hmce"
                        Return Enums.WeaponTypeType.TwoHandedMaces
                    Case "plarm"
                        Return Enums.WeaponTypeType.Polearms
                    Case "1hswd"
                        Return Enums.WeaponTypeType.OneHandedSwords
                    Case "2hswd"
                        Return Enums.WeaponTypeType.TwoHandedSwords
                    Case "stv"
                        Return Enums.WeaponTypeType.Staves
                    Case "fwpn"
                        Return Enums.WeaponTypeType.FistWeapons
                    Case "misc"
                        Return Enums.WeaponTypeType.Miscellanous
                    Case "dggr"
                        Return Enums.WeaponTypeType.Daggers
                    Case "thrwn"
                        Return Enums.WeaponTypeType.Thrown
                    Case "xbow"
                        Return Enums.WeaponTypeType.Crossbows
                    Case "wnd"
                        Return Enums.WeaponTypeType.Wands
                    Case "fshpl"
                        Return Enums.WeaponTypeType.FishingPole
                    Case Else
                        Return Enums.WeaponTypeType.AllWeaponTypes
                End Select
            End Get
            Set(ByVal value As Enums.WeaponTypeType)
                If ItemType <> "weapons" Then
                    Clear()
                End If
                ItemType = "weapons"
                Select Case value
                    Case Enums.WeaponTypeType.OneHandedAxes
                        WeaponType = "1haxe"
                    Case Enums.WeaponTypeType.TwoHandedAxes
                        WeaponType = "2haxe"
                    Case Enums.WeaponTypeType.Bows
                        WeaponType = "bow"
                    Case Enums.WeaponTypeType.Guns
                        WeaponType = "gun"
                    Case Enums.WeaponTypeType.OneHandedMaces
                        WeaponType = "1hmce"
                    Case Enums.WeaponTypeType.TwoHandedMaces
                        WeaponType = "2hmce"
                    Case Enums.WeaponTypeType.Polearms
                        WeaponType = "plarm"
                    Case Enums.WeaponTypeType.OneHandedSwords
                        WeaponType = "1hswd"
                    Case Enums.WeaponTypeType.TwoHandedSwords
                        WeaponType = "2hswd"
                    Case Enums.WeaponTypeType.Staves
                        WeaponType = "stv"
                    Case Enums.WeaponTypeType.FistWeapons
                        WeaponType = "fwpn"
                    Case Enums.WeaponTypeType.Miscellanous
                        WeaponType = "misc"
                    Case Enums.WeaponTypeType.Daggers
                        WeaponType = "dggr"
                    Case Enums.WeaponTypeType.Thrown
                        WeaponType = "thrwn"
                    Case Enums.WeaponTypeType.Crossbows
                        WeaponType = "xbow"
                    Case Enums.WeaponTypeType.Wands
                        WeaponType = "wnd"
                    Case Enums.WeaponTypeType.FishingPole
                        WeaponType = "fshpl"
                End Select
            End Set
        End Property

        ''' <summary>
        ''' The minimum required level of the items to search for
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property RequiredLevelMinFilter As Integer
            Get
                Return RequiredLevelMin
            End Get
            Set(ByVal value As Integer)
                If (From i In strItemTypesWithRequiredLevel Where i.ToString = ItemType).Count = 0 Then
                    Throw New InvalidOperationException("The Required Level filter is only valid for ItemType values AllItems, Weapons, and Armor.")
                    Exit Property
                End If

                If value < 0 Or value > 80 Then
                    Throw New ArgumentOutOfRangeException("value", "The Required Level must set be between 1 and 80, or set to 0 to ignore the filter.")
                    Exit Property
                End If

                RequiredLevelMin = value
            End Set
        End Property

        ''' <summary>
        ''' The maximum required level of the items to search for
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property RequiredLevelMaxFilter As Integer
            Get
                Return RequiredLevelMax
            End Get
            Set(ByVal value As Integer)
                If (From i In strItemTypesWithRequiredLevel Where i.ToString = ItemType).Count = 0 Then
                    Throw New InvalidOperationException("The Required Level filter is only valid for ItemType values AllItems, Weapons, and Armor.")
                    Exit Property
                End If

                If value < 0 Or value > 80 Then
                    Throw New ArgumentOutOfRangeException("value", "The Required Level must be set between 1 and 80, or set to 0 to ignore the filter.")
                    Exit Property
                End If

                RequiredLevelMax = value
            End Set
        End Property

        ''' <summary>
        ''' The slot of the armor to search for
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property ArmorSlotFilter As Enums.ArmorSlotType
            Get
                Select Case ArmorSlot
                    Case "head"
                        Return Enums.ArmorSlotType.Head
                    Case "neck"
                        Return Enums.ArmorSlotType.Neck
                    Case "shoulders"
                        Return Enums.ArmorSlotType.Shoulders
                    Case "back"
                        Return Enums.ArmorSlotType.Back
                    Case "chest"
                        Return Enums.ArmorSlotType.Chest
                    Case "shirt"
                        Return Enums.ArmorSlotType.Shirt
                    Case "wrists"
                        Return Enums.ArmorSlotType.Wrists
                    Case "hands"
                        Return Enums.ArmorSlotType.Hands
                    Case "waist"
                        Return Enums.ArmorSlotType.Waist
                    Case "legs"
                        Return Enums.ArmorSlotType.Legs
                    Case "feet"
                        Return Enums.ArmorSlotType.Feet
                    Case "finger"
                        Return Enums.ArmorSlotType.Finger
                    Case "trinket"
                        Return Enums.ArmorSlotType.Trinket
                    Case "offhand"
                        Return Enums.ArmorSlotType.OffHandFrill
                    Case Else
                        Return Enums.ArmorSlotType.AllSlots
                End Select
            End Get
            Set(ByVal value As Enums.ArmorSlotType)
                If ItemType <> "armor" Then
                    Clear()
                End If
                ItemType = "armor"
                Select Case value
                    Case Enums.ArmorSlotType.AllSlots
                        ArmorSlot = ""
                    Case Enums.ArmorSlotType.Head
                        ArmorSlot = "head"
                    Case Enums.ArmorSlotType.Neck
                        ArmorSlot = "neck"
                    Case Enums.ArmorSlotType.Shoulders
                        ArmorSlot = "shoulders"
                    Case Enums.ArmorSlotType.Back
                        ArmorSlot = "back"
                    Case Enums.ArmorSlotType.Chest
                        ArmorSlot = "chest"
                    Case Enums.ArmorSlotType.Shirt
                        ArmorSlot = "shirt"
                    Case Enums.ArmorSlotType.Wrists
                        ArmorSlot = "wrists"
                    Case Enums.ArmorSlotType.Hands
                        ArmorSlot = "hands"
                    Case Enums.ArmorSlotType.Waist
                        ArmorSlot = "waist"
                    Case Enums.ArmorSlotType.Legs
                        ArmorSlot = "legs"
                    Case Enums.ArmorSlotType.Feet
                        ArmorSlot = "feet"
                    Case Enums.ArmorSlotType.Finger
                        ArmorSlot = "finger"
                    Case Enums.ArmorSlotType.Trinket
                        ArmorSlot = "trinket"
                    Case Enums.ArmorSlotType.OffHandFrill
                        ArmorSlot = "offhand"
                End Select
            End Set
        End Property

        ''' <summary>
        ''' The type of the armor to search for
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property ArmorTypeFilter As Enums.ArmorTypeType
            Get
                Select Case ArmorType
                    Case "cloth"
                        Return Enums.ArmorTypeType.Cloth
                    Case "leather"
                        Return Enums.ArmorTypeType.Leather
                    Case "mail"
                        Return Enums.ArmorTypeType.Mail
                    Case "plate"
                        Return Enums.ArmorTypeType.Plate
                    Case "shield"
                        Return Enums.ArmorTypeType.Shield
                    Case "idol"
                        Return Enums.ArmorTypeType.Idol
                    Case "libram"
                        Return Enums.ArmorTypeType.Libram
                    Case "totem"
                        Return Enums.ArmorTypeType.Totem
                    Case "sigil"
                        Return Enums.ArmorTypeType.Sigil
                    Case "miscellaneous"
                        Return Enums.ArmorTypeType.Miscellaneous
                    Case Else
                        Return Enums.ArmorTypeType.AllArmorTypes
                End Select
            End Get
            Set(ByVal value As Enums.ArmorTypeType)
                If ItemType <> "armor" Then
                    Clear()
                End If
                ItemType = "armor"
                Select Case value
                    Case Enums.ArmorTypeType.AllArmorTypes
                        ArmorType = ""
                    Case Enums.ArmorTypeType.Cloth
                        ArmorType = "cloth"
                    Case Enums.ArmorTypeType.Leather
                        ArmorType = "leather"
                    Case Enums.ArmorTypeType.Mail
                        ArmorType = "mail"
                    Case Enums.ArmorTypeType.Plate
                        ArmorType = "plate"
                    Case Enums.ArmorTypeType.Shield
                        ArmorType = "shield"
                    Case Enums.ArmorTypeType.Idol
                        ArmorType = "idol"
                    Case Enums.ArmorTypeType.Libram
                        ArmorType = "libram"
                    Case Enums.ArmorTypeType.Totem
                        ArmorType = "totem"
                    Case Enums.ArmorTypeType.Sigil
                        ArmorType = "sigil"
                    Case Enums.ArmorTypeType.Miscellaneous
                        ArmorType = "miscellaneous"
                End Select
            End Set
        End Property

        ''' <summary>
        ''' The type of gem to search for
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property GemTypeFilter As Enums.GemTypeType
            Get
                Select Case GemType
                    Case "blue"
                        Return Enums.GemTypeType.Blue
                    Case "red"
                        Return Enums.GemTypeType.Red
                    Case "yellow"
                        Return Enums.GemTypeType.Yellow
                    Case "meta"
                        Return Enums.GemTypeType.Meta
                    Case "green"
                        Return Enums.GemTypeType.Green
                    Case "orange"
                        Return Enums.GemTypeType.Orange
                    Case "purple"
                        Return Enums.GemTypeType.Purple
                    Case "prismatic"
                        Return Enums.GemTypeType.Prismatic
                    Case Else
                        Return Enums.GemTypeType.AllGemTypes
                End Select
            End Get
            Set(ByVal value As Enums.GemTypeType)
                Clear()
                ItemType = "gems"
                Select Case value
                    Case Enums.GemTypeType.AllGemTypes
                        GemType = ""
                    Case Enums.GemTypeType.Blue
                        GemType = "blue"
                    Case Enums.GemTypeType.Red
                        GemType = "red"
                    Case Enums.GemTypeType.Yellow
                        GemType = "yellow"
                    Case Enums.GemTypeType.Meta
                        GemType = "meta"
                    Case Enums.GemTypeType.Green
                        GemType = "green"
                    Case Enums.GemTypeType.Orange
                        GemType = "orange"
                    Case Enums.GemTypeType.Purple
                        GemType = "purple"
                    Case Enums.GemTypeType.Prismatic
                        GemType = "prismatic"
                End Select
            End Set
        End Property

        ''' <summary>
        ''' The type of bag to search for
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property ContainerTypeFilter As Enums.BagTypeType
            Get
                Select Case BagType
                    Case "bag"
                        Return Enums.BagTypeType.Bag
                    Case "soul"
                        Return Enums.BagTypeType.SoulBag
                    Case "herb"
                        Return Enums.BagTypeType.HerbBag
                    Case "enchanting"
                        Return Enums.BagTypeType.EnchantingBag
                    Case "engineering"
                        Return Enums.BagTypeType.EngineeringBag
                    Case "gem"
                        Return Enums.BagTypeType.GemBag
                    Case "mining"
                        Return Enums.BagTypeType.MiningBag
                    Case Else
                        Return Enums.BagTypeType.AllBags
                End Select
            End Get
            Set(ByVal value As Enums.BagTypeType)
                Clear()
                ItemType = "containers"
                Select Case value
                    Case Enums.BagTypeType.AllBags
                        BagType = ""
                    Case Enums.BagTypeType.Bag
                        BagType = "bag"
                    Case Enums.BagTypeType.SoulBag
                        BagType = "soul"
                    Case Enums.BagTypeType.HerbBag
                        BagType = "herb"
                    Case Enums.BagTypeType.EnchantingBag
                        BagType = "enchanting"
                    Case Enums.BagTypeType.EngineeringBag
                        BagType = "engineering"
                    Case Enums.BagTypeType.GemBag
                        BagType = "gem"
                    Case Enums.BagTypeType.MiningBag
                        BagType = "mining"
                End Select
            End Set
        End Property

        ''' <summary>
        ''' The type of projectiles to search for
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property ProjectilesTypeFilter As Enums.ProjectileTypeType
            Get
                Select Case ProjectilesType
                    Case "arrow"
                        Return Enums.ProjectileTypeType.Arrow
                    Case "bullet"
                        Return Enums.ProjectileTypeType.Bullet
                    Case Else
                        Return Enums.ProjectileTypeType.AllProjectiles
                End Select
            End Get
            Set(ByVal value As Enums.ProjectileTypeType)
                Clear()
                ItemType = "projectiles"
                Select Case value
                    Case Enums.ProjectileTypeType.AllProjectiles
                        ProjectilesType = ""
                    Case Enums.ProjectileTypeType.Arrow
                        ProjectilesType = "arrow"
                    Case Enums.ProjectileTypeType.Bullet
                        ProjectilesType = "bullet"
                End Select
            End Set
        End Property

        ''' <summary>
        ''' The type of quiver to search for
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property QuiverTypeFilter As Enums.QuiverTypeType
            Get
                Select Case QuiversType
                    Case "quiver"
                        Return Enums.QuiverTypeType.Quiver
                    Case "ammopouch"
                        Return Enums.QuiverTypeType.AmmoPouch
                    Case Else
                        Return Enums.QuiverTypeType.AllQuivers
                End Select
            End Get
            Set(ByVal value As Enums.QuiverTypeType)
                Clear()
                ItemType = "quivers"
                Select Case value
                    Case Enums.QuiverTypeType.AllQuivers
                        QuiversType = ""
                    Case Enums.QuiverTypeType.Quiver
                        QuiversType = "quiver"
                    Case Enums.QuiverTypeType.AmmoPouch
                        QuiversType = "ammopouch"
                End Select
            End Set
        End Property

        ''' <summary>
        ''' The type of recipe to search for
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property RecipesTypeFilter As Enums.RecipesTypeType
            Get
                Select Case RecipesType
                    Case "books"
                        Return Enums.RecipesTypeType.Books
                    Case "leatherworking"
                        Return Enums.RecipesTypeType.Leatherworking
                    Case "tailoring"
                        Return Enums.RecipesTypeType.Tailoring
                    Case "engineering"
                        Return Enums.RecipesTypeType.Engineering
                    Case "blacksmithing"
                        Return Enums.RecipesTypeType.Blacksmithing
                    Case "cooking"
                        Return Enums.RecipesTypeType.Cooking
                    Case "alchemy"
                        Return Enums.RecipesTypeType.Alchemy
                    Case "firstaid"
                        Return Enums.RecipesTypeType.FirstAid
                    Case "enchanting"
                        Return Enums.RecipesTypeType.Enchanting
                    Case "fishing"
                        Return Enums.RecipesTypeType.Fishing
                    Case "jewelcrafting"
                        Return Enums.RecipesTypeType.Jewelcrafting
                    Case Else
                        Return Enums.RecipesTypeType.AllRecipes
                End Select
            End Get
            Set(ByVal value As Enums.RecipesTypeType)
                If ItemType <> "recipes" Then
                    Clear()
                End If
                ItemType = "recipes"
                Select Case value
                    Case Enums.RecipesTypeType.AllRecipes
                        RecipesType = ""
                    Case Enums.RecipesTypeType.Books
                        RecipesType = "books"
                    Case Enums.RecipesTypeType.Leatherworking
                        RecipesType = "leatherworking"
                    Case Enums.RecipesTypeType.Tailoring
                        RecipesType = "tailoring"
                    Case Enums.RecipesTypeType.Engineering
                        RecipesType = "engineering"
                    Case Enums.RecipesTypeType.Blacksmithing
                        RecipesType = "blacksmithing"
                    Case Enums.RecipesTypeType.Cooking
                        RecipesType = "cooking"
                    Case Enums.RecipesTypeType.Alchemy
                        RecipesType = "alchemy"
                    Case Enums.RecipesTypeType.FirstAid
                        RecipesType = "firstaid"
                    Case Enums.RecipesTypeType.Enchanting
                        RecipesType = "enchanting"
                    Case Enums.RecipesTypeType.Fishing
                        RecipesType = "fishing"
                    Case Enums.RecipesTypeType.Jewelcrafting
                        RecipesType = "jewelcrafting"
                End Select
            End Set
        End Property

        ''' <summary>
        ''' The minimum skill level of the recipes to search for
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property SkillLevelMinFilter As Integer
            Get
                Return SkillLevelMin
            End Get
            Set(ByVal value As Integer)
                If SkillLevelMin < 0 Or SkillLevelMin > 450 Then
                    Throw New ArgumentOutOfRangeException("value", "The Skill Level must be set between 1 and 450, or set to 0 to ignore the filter.")
                    Exit Property
                End If

                If ItemType <> "recipes" Then
                    Clear()
                End If
                ItemType = "recipes"
                SkillLevelMin = value
            End Set
        End Property

        ''' <summary>
        ''' The maximum skill level of the recipes to search for
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property SkillLevelMaxFilter As Integer
            Get
                Return SkillLevelMax
            End Get
            Set(ByVal value As Integer)
                If SkillLevelMax < 0 Or SkillLevelMax > 450 Then
                    Throw New ArgumentOutOfRangeException("value", "The Skill Level must be set between 1 and 450, or set to 0 to ignore the filter.")
                    Exit Property
                End If

                If ItemType <> "recipes" Then
                    Clear()
                End If
                ItemType = "recipes"
                SkillLevelMax = value
            End Set
        End Property

        ''' <summary>
        ''' The slot of the permanent enchantment to search for
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property PermanentEnchantmentSlotFilter As Enums.PermanentEnchantmentSlotType
            Get
                Select Case PermanentEnchantmentSlot
                    Case "head"
                        Return Enums.PermanentEnchantmentSlotType.Head
                    Case "shoulders"
                        Return Enums.PermanentEnchantmentSlotType.Shoulders
                    Case "chest"
                        Return Enums.PermanentEnchantmentSlotType.Chest
                    Case "back"
                        Return Enums.PermanentEnchantmentSlotType.Back
                    Case "hands"
                        Return Enums.PermanentEnchantmentSlotType.Hands
                    Case "wrists"
                        Return Enums.PermanentEnchantmentSlotType.Wrists
                    Case "legs"
                        Return Enums.PermanentEnchantmentSlotType.Legs
                    Case "feet"
                        Return Enums.PermanentEnchantmentSlotType.Feet
                    Case "weapon"
                        Return Enums.PermanentEnchantmentSlotType.Weapon
                    Case "shield"
                        Return Enums.PermanentEnchantmentSlotType.Shield
                    Case Else
                        Return Enums.PermanentEnchantmentSlotType.AllSlots
                End Select
            End Get
            Set(ByVal value As Enums.PermanentEnchantmentSlotType)
                Clear()
                ItemType = "enchP"
                Select Case value
                    Case Enums.PermanentEnchantmentSlotType.AllSlots
                        PermanentEnchantmentSlot = ""
                    Case Enums.PermanentEnchantmentSlotType.Head
                        PermanentEnchantmentSlot = "head"
                    Case Enums.PermanentEnchantmentSlotType.Shoulders
                        PermanentEnchantmentSlot = "shoulders"
                    Case Enums.PermanentEnchantmentSlotType.Chest
                        PermanentEnchantmentSlot = "chest"
                    Case Enums.PermanentEnchantmentSlotType.Back
                        PermanentEnchantmentSlot = "back"
                    Case Enums.PermanentEnchantmentSlotType.Hands
                        PermanentEnchantmentSlot = "hands"
                    Case Enums.PermanentEnchantmentSlotType.Wrists
                        PermanentEnchantmentSlot = "wrists"
                    Case Enums.PermanentEnchantmentSlotType.Legs
                        PermanentEnchantmentSlot = "legs"
                    Case Enums.PermanentEnchantmentSlotType.Feet
                        PermanentEnchantmentSlot = "feet"
                    Case Enums.PermanentEnchantmentSlotType.Weapon
                        PermanentEnchantmentSlot = "weapon"
                    Case Enums.PermanentEnchantmentSlotType.Shield
                        PermanentEnchantmentSlot = "shield"
                End Select
            End Set
        End Property

        ''' <summary>
        ''' A function that clears the current filter
        ''' </summary>
        ''' <remarks></remarks>
        Public Sub Clear()
            ItemType = "all"
            DesiredBy = 0
            DesiredByRole = ""
            WeaponSlot = ""
            WeaponType = ""
            RequiredLevelMin = 0
            RequiredLevelMax = 0
            ArmorSlot = ""
            ArmorType = ""
            GemType = ""
            BagType = ""
            ProjectilesType = ""
            QuiversType = ""
            RecipesType = ""
            SkillLevelMin = 0
            SkillLevelMax = 0
            PermanentEnchantmentSlot = ""
        End Sub

    End Class

End Namespace